package commandAction;

import java.awt.Component;
import java.util.Iterator;
import abbot.tester.ComponentTester;
import com.supermap.desktop.Application;
import command.Command;
import command.SearchMap;

public class ActionMenu extends Action {
	Object item = null;
	@Override
	public Object action(Command cmd) {
		Iterator<SearchMap> iterator = cmd.getSearchMap().iterator();
		if (iterator.hasNext()) {
			SearchMap map = iterator.next();
			item = map.getValue();
			ComponentTester tester = new ComponentTester();
			Component frame = (Component) Application.getActiveApplication().getMainFrame();
			tester.actionSelectMenuItem(frame, item.toString());
			abbot.tester.Robot.delay(3000);
		}
		return item;
   }
}